package com.mt.restaurant.entity.material;

import javax.persistence.*;
import java.io.Serializable;
import com.mt.common.core.annotation.DColumn;
import com.mt.common.core.annotation.DEntity;
import com.mt.common.core.web.base.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;



import com.mt.restaurant.entity.material.Material;

@DEntity(label="仓库材料关系",comment="",moduleLabel="原材料管理")
@Entity(name="restaurant_store_material")
@Table(name = "restaurant_store_material" , indexes = { @Index(name = "index_material_id", columnList = "material_id")  })
@ApiModel(description = "仓库材料关系:")
public class StoreMaterial extends BaseEntity implements Serializable{
	private static final long serialVersionUID = 1L;

	@DColumn(index=3,label="材料",foreignEntity="Material",comment="",component="对象选择",where=false)
	@ApiModelProperty(value = "材料:")
	@Column(name="material_id",length=255,nullable=false,unique=false)
	private Long materialId;

	@Transient
	private Material material;

	@Transient
	@ApiModelProperty(value = "材料名称:")
	@DColumn(index=3,label="材料",foreignEntity="Material",comment="")
	private String materialName;

	@DColumn(index=4,label="库存数量",comment="",component="数字，小数",where=false)
	@ApiModelProperty(value = "库存数量:")
	@Column(name="quantity",length=255,nullable=false,unique=false)
	private Double quantity;

	@DColumn(index=5,label="价格",comment="每次购买这种材料都要更新价格",component="数字，小数",where=false)
	@ApiModelProperty(value = "价格:每次购买这种材料都要更新价格")
	@Column(name="price",length=255,nullable=false,unique=false)
	private Double price;

	@DColumn(index=6,label="订单状态",comment="订单状态",component="文本",where=false)
	@ApiModelProperty(value = "订单状态:订单状态")
	@Column(name="status",length=255,nullable=true,unique=false)
	private String status;


	public Long getMaterialId() {
		return this.materialId;
	}

	public void setMaterialId(Long materialId) {
		this.materialId = materialId;
	}

	public Double getQuantity() {
		return this.quantity;
	}

	public void setQuantity(Double quantity) {
		this.quantity = quantity;
	}

	public Double getPrice() {
		return this.price;
	}

	public void setPrice(Double price) {
		this.price = price;
	}

	public String getStatus() {
		return this.status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

	public Material getMaterial() {
		return this.material;
	}

	public void setMaterial(Material material) {
		if(material == null){
		}
		else
		{
		this.materialId = material.getEid();
		this.material = material;		
		}
}

	public String getMaterialName() {
		return this.materialName;
	}

	public void setMaterialName(String materialName) {
		this.materialName = materialName;
	}



}
